const {service} = require("../request");
const model = require("../../utils/modelUtil");

/**
 * 竞技场
 */
class Sports {
    constructor(user) {
        this.user = user;
    }

    getData() {
        return new Promise((resolve, reject) => {
            service({
                method: 'POST',
                url: this.user.game.reqUrl + '/getChatPkAward',
                data: model.userModel('getChatPkAward', {}, this.user.game.isWeb, this.user.game.data),
            }).then(res => {
                const resData = res.data;
                resolve(resData.code===200?resData.MsgData:{});
            }).catch(err => {
                reject(err);
            })
        })
    }

    getReward() {
        return new Promise((resolve, reject) => {
            service({
                method: 'POST',
                url: this.user.game.reqUrl + '/receiveChatPkAward',
                data: model.userModel('receiveChatPkAward', {}, this.user.game.isWeb, this.user.game.data),
            }).then(res => {
                const resData = res.data;
                resolve(resData.code===200?resData.MsgData:{});
            }).catch(err => {
                reject(err);
            })
        })
    }
}

module.exports = Sports;